package com.example.myapplication9.weeek3.experience;

import java.io.*;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Link {
     public static void main(String[] args) throws IOException {
        LinkedList link=new LinkedList();
        node head=null;
        Scanner scan =new Scanner(System.in);
        System.out.println("请输入整数");
        String b=scan.nextLine();
        StringTokenizer a=new StringTokenizer(b);
        if(a.hasMoreTokens()) {
             head=new node(Integer.valueOf(a.nextToken()));
        }
        while(a.hasMoreTokens())
        {
            link.insernode(Integer.valueOf(a.nextToken()),head);
        }
        link.printNode(head);
        link.length(head);
        System.out.println("元素总数为"+link.nDuanZhiXuan);
         File file = new File("C:\\Users\\24098\\duan_zhixuan_20172304java\\untitled\\src\\weeek3\\experience\\sort.txt");
         Reader reader = new FileReader(file);
         BufferedReader bufferedReader = new BufferedReader(reader);
         StringTokenizer Tokenizer = new StringTokenizer(bufferedReader.readLine());
         int []num=new int[2];
         int ab=0;
         while(Tokenizer.hasMoreTokens())
         {
             num[ab]=Integer.parseInt(Tokenizer.nextToken());
            ab++;
         }
       link.insernode(num[0],5,head);
         link.printNode(head);
         link.length(head);
         System.out.println("元素总数"+link.nDuanZhiXuan);
         head=link.insernode(num[1],0,head);
         link.printNode(head);
         link.length(head);
         System.out.println("元素总数"+link.nDuanZhiXuan);
         head=link.deletenode(head,num[0]);
         link.printNode(head);
         link.length(head);
         System.out.println("元素总数"+link.nDuanZhiXuan);
         link.selectsort(head);
         }

}
